package com.example.blog.entity;

import com.example.blog.enums.CommentEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * @ClassName: comments
 * @Description: 帖子评论

 * @Date 2023/9/9
 * @Version 1.0
 */
@Table(name = "comments")
@Data
@Slf4j
@Entity
@Builder
@DynamicInsert
@DynamicUpdate
@AllArgsConstructor
@NoArgsConstructor
public class Comments {
    @Id
    @GeneratedValue(generator = "faceset_generator")
    @GenericGenerator(name = "faceset_generator", strategy = "uuid")
    @Column(name = "id",nullable = false,columnDefinition = "varchar(64) not null comment '主键id'")
    private String id;
    @Lob
    @Basic(fetch=FetchType.LAZY)
    @Column(name = "content",nullable = false,columnDefinition ="varchar(128) not null comment '评论内容'")
    private String content;
    @Column(name = "userId",nullable = false,columnDefinition ="varchar(128) not null comment '评论者'")
    private String userId;
    @Column(name = "cTime",nullable = false,columnDefinition ="datetime not null comment '评论时间'")
    private Date cTime;
    @Column(name = "postInfoId",columnDefinition ="varchar(128) not null comment '帖子id'")
    private String postInfoId;
    @Column(name = "updTime",insertable = true,updatable = false,columnDefinition ="datetime not null comment '更新时间'")
    private Date updTime;
    @Column(name = "status",nullable = false,columnDefinition ="bit(1) not null comment '0-true，1-false,评论状态'")
    private boolean status;
}
